<?php
/**
 * Application level Controller
 *
 * This file is application-wide controller file. You can put all
 * application-wide controller-related methods here.
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.app
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/**
 * Application Controller
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @package       cake
 * @subpackage    cake.app
 */

App::import ( 'Vendor', 'weibo/weibooauth' );

class AppController extends Controller {
	public $components = array('DebugKit.Toolbar','Cookie','Session',
    'Auth'=> array(
        'authenticate' => array(
            'Form' => array(
                'fields' => array('username' => 'email','password'=>'password')
            )
        )
    )
);
	function beforeFilter() {
		
		$this->Auth->allow ( '*' );
		$this->loadModel ( 'User' );
		
		$this->Cookie->time = "7 days";
		$this->Cookie->domain = "book.lupinlin.com";
		$this->Cookie->key = "23fj0$(&feefgf";
		
		$this->set('isLogin',false);
		$user = $this->Auth->user();
		if (isset($user))
		{
			$this->set ( 'isLogin', true );
			$this->set( 'user', $user);
		}
			
	
	}

}
